package com.soilflow.common.errorcode;

public class ErrorCode {

    /**
     * 公共错误码<br/>
     * 码段：0~9999
     *
     */
    public enum CommonError implements IErrorCode {
        SUCCESS(0, "success"),
        BAD_REQUEST(400, "参数列表错误"),
        UNAUTHORIZED(401, "未授权"),
        FORBIDDEN(403, "访问受限，授权过期"),
        NOT_FOUND(404, "资源，服务未找到"),
        ERROR(500, "系统内部错误"),
        NOT_IMPLEMENTED(501, "接口未实现")
        ;

        private int code;
        private String msg;
        private CommonError(int code, String msg) {
            this.code = code;
            this.msg = msg;
        }
        @Override
        public int getCode() {
            return this.code;
        }
        @Override
        public String getMsg() {
            return this.msg;
        }
    }

    /**
     * 通用业务-系统<br/>
     * 码段：10000~19999
     *
     */
    public enum SystemUserError implements IErrorCode {
        //例子开始
        USER_NAME_EXISTS(10100, "用户名已存在"),
        OLD_PASSWORD_ERROR(10104, "旧密码错误"),
        ;
        //例子结束

        private int code;
        private String msg;
        private SystemUserError(int code, String msg) {
            this.code = code;
            this.msg = msg;
        }
        @Override
        public int getCode() {
            return this.code;
        }

        @Override
        public String getMsg() {
            return this.msg;
        }

    }

    /**
     * 具体业务-客户<br/>
     * 码段：20000~29999
     *
     */
    public enum CustomerError implements IErrorCode {
        CUSTOMER_USER_NOT_EXISTS(20000, "用户不存在"),
        DATA_NOT_EXISTS(20001, "数据不存在"),
        DATA_EXISTS(20002, "数据已存在"),
        DATA_ALREADY_DEFAULT(20003, "已存在默认数据"),
        ONEKEY_ENABLE_FAIL(20004,"一键启用失败"),
        ONEKEY_FORBID_FAIL(20005,"一键禁用失败"),
        ATA_ALREADY_LIKE(20006, "已存在相似数据"),
        UNITS_EVALUATION_ING(20007, "评定中"),
        ;

        private int code;
        private String msg;

        private CustomerError(int code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        @Override
        public int getCode() {
            return this.code;
        }

        @Override
        public String getMsg() {
            return this.msg;
        }

    }

    /**
     * 具体业务-终端<br/>
     * 码段：30000~39999
     *
     */
    public enum EquipmentError implements IErrorCode {
        //例子开始
        EQUIPMENT_NUMBER_EXISTS(30001, "终端编号已存在"),
        EQUIPMENT_GET_HIKVINSION_TOKEN_FAIL(30002, "获取摄像头播放地址失败"),;
        //例子结束

        private int code;
        private String msg;

        private EquipmentError(int code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        @Override
        public int getCode() {
            return this.code;
        }

        @Override
        public String getMsg() {
            return this.msg;
        }

    }

}
